const http = require("http");
const fs = require('fs');
const hostname = "127.0.0.1";
const port = 8080;
http.createServer((request, response) => {
    console.log(request.complete);
    // request.on("data", function (chunk) {
    //     console.log(chunk.toString());
    // })
    console.log(request.url);
    // response.statusCode = 200;
    // response.setHeader('Content-Type', 'text/plain;charset=utf-8');
    response.writeHead(200, {
        'Content-Type': 'text/html;charset=utf-8',
    });
    var html = fs.readFileSync('../JS学习/learnDom.html')
    response.write(html);
    var str = 'hello Nodejs罗';
    response.end(str);

}).listen(port, hostname, function () {
    console.log('Server running at http://127.0.0.1:8080');
});
